package com.wxh.autoconfig;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @ClassName: PropertiesBean
 * @Description: 配置文件bean
 * @Author wxh
 * @Date: 2021/12/21 16:48
 * @Version V1.0.0
 * @Since 1.8
 */
@Component
@ConfigurationProperties(prefix = "spring.datasource.master")
public class PropertiesBean {

    /**
     * @ConfigurationProperties 注解的作用是把yml或者properties配置文件转化为bean
     * @EnableConfigurationProperties 注解的作用是使@ConfigurationProperties注解生效
     */
    private String url;
    private String username;
    private String password;
    private String driverClassName;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDriverClassName() {
        return driverClassName;
    }

    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }

    @Override
    public String toString() {
        return "PropertiesBean{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", driverClassName='" + driverClassName + '\'' +
                '}';
    }
}
